home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Examples / cameraTests / lightTests / someCameras.cam < prev    next >
Encoding:
Text File  |  1995-03-22  |  1.7 KB  |  45 lines

  1. set anExampleCam "{fieldOfView 40} \
  2.                   {projectionType perspective} \
  3.                   {backgroundColor {0 0 0}} \
  4.                   {doesDrawBackgroundColor 1} \
  5.                   {nearPlane -1} \
  6.                   {farPlane 100} \
  7.                   {eyePoint {1 1 -1}} \
  8.                   {viewPoint {0 0 0}} \
  9.                   {roll 0} \
  10.                   {pixelAspectRatio 1.0} \
  11.                   {fStop 2.8} \
  12.                   {focalLength 1.0} \
  13.                   {focalDistance 2.0} \
  14.                   {} \
  15.                   {}"
  16.  
  17. lappend cam(templateList) anExampleCam
  18.  
  19. # need to add the previous defined cameras into the current camera object
  20. # we do this by appending them to a variable list named cam(snapshotList)
  21. # this variable has traces set up on it so that when it is read or written 
  22. # it accurately reflects the internal state of the camera
  23.  
  24. # the following just does a simple linear interpolation from the start
  25. # camera's eye point to the end camera's eye point
  26. proc anExampleCameraInterpolationProc {u} {
  27.  
  28. global sCam eCam cam
  29.  
  30.   set xDifference [expr {[lindex $eCam(eyePoint) 0] - [lindex $sCam(eyePoint) 0]};
  31.   set yDifference [expr {[lindex $eCam(eyePoint) 1] - [lindex $sCam(eyePoint) 1]};
  32.   set zDifference [expr {[lindex $eCam(eyePoint) 2] - [lindex $sCam(eyePoint) 2]};
  33.  
  34.   set newX [expr {$u * $xDifference}]
  35.   set newY [expr {$u * $yDifference}]
  36.   set newZ [expr {$u * $zDifference}]
  37.  
  38.   set newX [expr {$newX + [lindex $sCam(eyePoint) 0]}]
  39.   set newY [expr {$newY + [lindex $sCam(eyePoint) 1]}]
  40.   set newZ [expr {$newZ + [lindex $sCam(eyePoint) 2]}]
  41.  
  42.   set cam(eyePoint) "$newX $newY $newZ"
  43. }
  44.  
  45. lappend cam(interpolationProcList) anExampleCameraInterpolationProc